function compareVersion(v1, v2) {
  const a1 = v1.split('.').map(Number)
  const a2 = v2.split('.').map(Number)
  for(let i=0;i<Math.max(a1.length,a2.length);i++) {
    // if(a1[i]==a2[i]) continue
    // return a1[i]-a2[i] //配合sort排血
    const x = a1[i] || 0
    const y = a2[i] || 0
    if(x===y) continue
    return x>y ? 1:-1
  }
  return 0
}
arr = ['1.45.0', '1.45', '6', '3.3.3.3.3.3.3', ]
// console.log(arr.sort((a, b) => compareVersion(a, b)))
console.log(compareVersion('1.45.0', '3.3.3.3.3.3.3'))
console.log(compareVersion('1.45', '1.45'))
console.log(compareVersion('1.45', '1.4'))